<%-------------------------------------------------------------------
 * 页面名称：mySpace_content.jsp
 * 功能描述：我的账户页面
 * Action: 
 *
 *-------------------------------------------------------------------
--%>
<%@ page contentType="text/html; charset=utf-8"%>
<%@ taglib uri="struts-bean.tld" prefix="bean"%>
<%@ taglib uri="struts-logic.tld" prefix="logic"%>
<%@ page import="cn.agiledata.bank.common.util.Constant"%>
<%@ page import="cn.agiledata.bank.account.service.IAccountConst"%>
<%@ page import="cn.agiledata.bank.account.service.AccountSummary"%>
<%@ page import="cn.agiledata.bank.hibernateBean.AccountBank"%>
<%@ taglib uri="/WEB-INF/conf/tld/struts-html.tld" prefix="html"%>
<%@ taglib uri="/WEB-INF/conf/tld/struts-tiles.tld" prefix="tiles"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%@ taglib prefix="ipb" uri="/WEB-INF/conf/tld/ipb.tld"%>
<%@ taglib prefix="ad" uri="agiledata"%>
<%
	String path = request.getContextPath();
	AccountSummary user = (AccountSummary) session
			.getAttribute(Constant.SESSION_ACCOUNT_SUMMARY);
	AccountSummary account = (AccountSummary) request.getSession()
			.getAttribute("userinfo");
	request.setAttribute("first", "first");
	String name = account.getUser().getUsername();
	String email = account.getAccount().getEmail();
%>
<script language="javascript">
function openPhoto() {
	window.open('<%=path%>/page/common/showPhoto.action?dbProperty=photo', '', 'height=400,width=400, top=0, left=0, toolbar=no, menubar=no, scrollbars=no,resizable=yes,location=no, status=no');
}   

function MM_preloadImages() { //v3.0
  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}
function $(ID) { 
    return document.getElementById(ID); 
}
function showTab(ID) { 
    for(var i=1;i<=4;i++) 
    { 
        if(ID==i) 
        { 
            $('Tab_'+i).className='on'; 
            $('cont_'+i).style.display=''; 
        } 
        else 
        { 
            $('Tab_'+i).className='off'; 
            $('cont_'+i).style.display='none'; 
        } 
    } 
}
</script>
<div id="main">

	<%
	if (IAccountConst.USERTYPE_PERSONAL.equals(user.getUserType())) {
	%>
	<!-- 页面中部变更内容 -->

	<div class="content_right">
		<!-- 页面更改内容开始 -->
		<div style="width:745px;margin-left:10px;">
			<div class="titleinfo">
				账户信息
			</div>
			<div style="width:740px; margin-top:10px; height:330px;">
				<div class="myimage">
					<div>
						<a href="#" onclick="openPhoto();"><img
								src="<%=path%>/page/common/showPhoto.action?dbProperty=photo&amp;compressSize=133"
								border="0" /> </a>
					</div>
					<div>
						<a href="#" onclick="openPhoto();">查看照片</a>
					</div>
				</div>
				<div class="mymoney">
					<ul class="xinxi">
						<li>
							您好！
							<bean:write name="sessionAccountSummary" property="user.username" />
							&nbsp;&nbsp;&nbsp;
							<logic:empty name="idcardStatus">
								您未进行
								<a href="#"
									onclick="loading('<%=path%>/page/myspace/preSubmitIdcard.do');">身份认证</a>
							</logic:empty>
							<logic:equal name="idcardStatus"
								value="<%=Constant.AUTHENTICATION_STATUS_TOPUBMITTED%>">
								您未进行
								<a href="#"
									onclick="loading('<%=path%>/page/myspace/preSubmitIdcard.do');">身份认证</a>
							</logic:equal>
							<logic:equal name="idcardStatus"
								value="<%=Constant.AUTHENTICATION_STATUS_SUBMITTED%>">
								您已经提交了身份证认证</br>
								正在审核中……
							</logic:equal>
							<logic:equal name="idcardStatus"
								value="<%=Constant.AUTHENTICATION_STATUS_PASS%>">
								您已经通过了身份证认证
							</logic:equal>
							<logic:equal name="idcardStatus"
								value="<%=Constant.AUTHENTICATION_STATUS_UNPASS%>">
								您的身份证认证未通过
								<a href="#"
									onclick="loading('<%=path%>/page/myspace/preSubmitIdcard.do');">身份认证</a>
							</logic:equal>
						</li>
						<li>
							(
							<logic:notEmpty name="account" property="email">
								<bean:write name="account" property="email" />
							</logic:notEmpty>
							<logic:empty name="account" property="email">
								<bean:write name="account" property="mobile" />
							</logic:empty>
							)
						</li>
						<li>
							交易账户编码：
							<bean:write name="account" property="accountId" />
						</li>
						<logic:greaterThan name="waitTotal" value="0">

							<li>
								您有
								<span class="lan"><bean:write name="waitTotal" /> </span>
								笔待处理交易需要处理
								<span class="lan" style="font-size:12px;"><a href="#"
									onclick="loading('<%=path%>/route.do?modual=manage$query');">处理</a>
								</span>
							</li>
						</logic:greaterThan>

						<li>
							您的交易账户
							<%
						int subAccountNum = 0;
						%>
						</li>
						<logic:iterate id="sub" name="account" property="subAccounts">
							<%
							subAccountNum++;
							%>
							<li>
								<bean:write name="sub" property="accountName" />
								：
								<span class="lan"><bean:write name="sub"
										property="accountBalance.balance" format="#,###.##" /> </span>&nbsp;&nbsp;&nbsp;&nbsp;冻结金额：
								<logic:present name="sub" property="accountBalance.lockAmount">
									<span class="lan"><bean:write name="sub"
											property="accountBalance.lockAmount" format="#,###.##" /> </span>

								</logic:present>

							</li>
						</logic:iterate>
						<%
						if (subAccountNum > 0) {
						%>
						<li>
							余额汇总：
							<span class="lan"><bean:write name="sumBalance"
									format="#,###.##" /> </span>&nbsp;&nbsp;&nbsp;&nbsp;冻结金额汇总：
							<span class="lan"><bean:write name="sumAmount"
									format="#,###.##" /> </span>
						</li>
						<%
						}
						%>
						<li>
							<logic:equal name="account" property="emStatus"
								value="<%=Constant.ACCOUNT_STATE_INVALID%>">
								<li>
									<span class="lan"> <a href="#"
										onclick="loading('<%=path%>/route.do?modual=space$email');">开通Email绑定</a>
									</span>功能
								</li>
							</logic:equal>
							<logic:equal name="account" property="emStatus"
								value="<%=Constant.ACCOUNT_STATE_UNACTIVATED%>">
								<li>
									<span class="lan"><a href="#"
										onclick="loading('<%=path%>/toActivateEm.do');">激活Email绑定</a>
									</span>功能
									<span class="lan"><a href="#" title="使用手机取消Email绑定"
										onclick="if(confirm('您确认要取消Email绑定吗？')) loading('<%=path%>/page/myspace/mobileCancelEmail.do');">取消Email绑定</a>
									</span>功能(
									<bean:write name="account" property="email" />
									)
								</li>
							</logic:equal>
							<logic:equal name="account" property="emStatus"
								value="<%=Constant.ACCOUNT_STATE_NORMAL%>">
								<logic:equal name="account" property="mobStatus"
									value="<%=Constant.ACCOUNT_STATE_NORMAL%>">
									<li>
										<span class="lan"> <a href="#"
											onclick="if(confirm('您确认要取消Email绑定吗？')) loading('<%=path%>/toCancelEmail.do');">取消Email绑定</a>
										</span>功能(
										<bean:write name="account" property="email" />
										)
									</li>
								</logic:equal>
							</logic:equal>


							<logic:equal name="account" property="mobStatus"
								value="<%=Constant.ACCOUNT_STATE_INVALID%>">
								<li>
									<span class="lan"> <a href="#"
										onclick="loading('<%=path%>/route.do?modual=space$mobile');">开通手机绑定</a>
									</span>功能
								</li>
							</logic:equal>
							<logic:equal name="account" property="mobStatus"
								value="<%=Constant.ACCOUNT_STATE_UNACTIVATED%>">
								<li>
									<span class="lan"><a href="#"
										onclick="loading('<%=path%>/toActivateMob.do');">激活手机绑定</a> </span>功能
									<span class="lan"><a href="#"
										onclick="if(confirm('您确认要取消手机绑定吗？')) loading('<%=path%>/page/myspace/emailCancelMobile.do');">取消手机绑定</a>
									</span>功能(
									<bean:write name="account" property="mobile" />
									)
								</li>
							</logic:equal>
							<logic:equal name="account" property="mobStatus"
								value="<%=Constant.ACCOUNT_STATE_NORMAL%>">
								<logic:equal name="account" property="emStatus"
									value="<%=Constant.ACCOUNT_STATE_NORMAL%>">
									<li>
										<a href="#" title="取消手机绑定"
											onclick="if(confirm('您确认要取消手机绑定吗？')) loading('<%=path%>/toCancelMob.do');">取消手机绑定</a>功能(
										<bean:write name="account" property="mobile" />
										)
									</li>

								</logic:equal>
							</logic:equal>
							<logic:equal name="idcardStatus"
								value="<%=Constant.AUTHENTICATION_STATUS_SUBMITTED%>">
								<li>
								<logic:empty name="account" property="ivrLoginPassword">
									<a href="#" title="输入确认金额"
										onclick="loading('<%=path%>/toConfirmAmount.do');">输入确认金额</a>
								</logic:empty>
								
								</li>
								<logic:notEmpty name="account" property="ivrLoginPassword">
								<li>
										确认金额:  <bean:write name="account" property="ivrLoginPassword" />
								</li>
							</logic:notEmpty>
							</logic:equal>
							
							
						</li>
					</ul>
				</div>
				<div class="logininfo">
					<div class="title">
						<span class="biaoti">登录信息</span>
					</div>
					<div class="lastlogintime">
					</div>
					<div class="editemail">
						&nbsp;&nbsp;&nbsp;&nbsp;您可以使用以下账户登录到网站
						<br />
						&nbsp;&nbsp;&nbsp;&nbsp;
						<%=email%>
						&nbsp;&nbsp;

					</div>
					<div class="title" style="margin-top:5px;">
						<span class="biaoti">安全中心</span>
					</div>
					<div class="editemail" style="height:158px;">
						<table style="margin-left:10px;">
							<tr>
								<td width="78">
									登录密码
								</td>
								<td width="165">
									支付密码
								</td>
							</tr>
							<tr>
								<td>
									<span class="lan"><a href="#"
										onclick="loading('<%=path%>/page/myspace/toModifyPassword.do?modifyType=<%=IAccountConst.MODIFY_TYPE_LOGIN%>');"">修改登录密码</a>
									</span>
								</td>
								<td>
									<span class="lan"><a href="#"
										onclick="loading('<%=path%>/page/myspace/toModifyPassword.do?modifyType=<%=IAccountConst.MODIFY_TYPE_PAY%>');">修改支付密码</a>
										&nbsp;&nbsp;|&nbsp;&nbsp;<a
										href="<%=path%>/page/myspace/forgotPayPassword.do">找回支付密码</a>
									</span>
								</td>
							</tr>
							<tr>
								<td colspan="2">
									个人信息
								</td>
							</tr>
							<tr>
								<td height="34" colspan="2">
									<span class="lan"><a href="#"
										onclick="loading('<%=path%>/page/myspace/modifyAccountUserInfo.do');">个人信息修改</a>
									</span>
								</td>
							</tr>
						</table>
					</div>
				</div>
			</div>
			<div class="mybank">
				我的银行账户
			</div>
			<div class="mybank1">
				
				目前已添加了&nbsp;
				<span class="lan"><bean:write name="totalbank" /> </span>&nbsp;张银行卡&nbsp;&nbsp;&nbsp;&nbsp;
				<span class="lan"><a
					href="<%=path%>/page/myspace/accountList.do?modifyType=moveOut&modual=first">添加银行卡</a>
				</span>
		
			</div>
			<div class="bankli">
				<table width="100%" class="tablestyle">
					<tr>
						<%--<th>
							<span class="blue14">默认</span>
						</th>
						--%>
					<th>
							<span class="blue14">银行开户名称</span>
						</th>
						<th>
							<span class="blue14">银行帐号</span>
						</th>
						<th>
							<span class="blue14">开户行</span>
						</th>
						<th>
							<span class="blue14">编辑</span>
						</th>
					</tr>
					<%
					int aBankIndex = 0;
					%>
					<%
					String defaultId = "";
					%>
					<logic:iterate name="aBankList" id="aBank" indexId="i">
						<bean:define id="aBankObj" name="aBank" />
						<%
								AccountBank ab = (AccountBank) aBankObj;
								if (ab.getDefaultFlag().equals("Y")) {
									defaultId = String.valueOf(ab.getId());
								}
						%>
						<tr
							class="<%=i.intValue() % 2 == 0 ? "tableWhiteBg"
								: "tableBlueBg"%>">
							<%--<td height="28" align="center">
								<input
									onclick="javascript:confirmModify('<bean:write name="displayBean" property="msg1"/>','<bean:write name="aBank" property="id"/>');"
									type="radio" style="border:0"
									<logic:equal value="Y" name="aBank" property="defaultFlag">checked</logic:equal>
							</td>
							--%>
							<td align="center">
								<bean:write name="aBank" property="bankAlias" />
							</td>
							<td align="center">
								<bean:write name="aBank" property="accountId" />
							</td>
							<td align="center">
								<ad:write typeid="CITY_INFO" name="aBank" property="citySeq" />
							</td>
							<td align="center">
								<a
									href="<%=path%>/page/myspace/accountDetail.do?aBankID=<bean:write name="aBank" property="id"/>"><img
										alt="编辑" src="<%=path%>/images/edit_icon.gif" width="16"
										height="16" border="0" /> </a>
							</td>
						</tr>
						<%
						aBankIndex++;
						%>
					</logic:iterate>
				</table>

			</div>

		</div>
		<!-- 页面更改内容结束-->
	</div>
	<%
	} else {//企业用户登录（操作员或admin）
	%>
	<div class="content_right">
		<div style="width:745px;margin-left:10px;">
			<div class="titleinfo">
				企业交易账户信息
			</div>
			<div style="width:740px; margin-top:10px; height:330px;">
				<div class="myimage">
					<div>
						<a href="#" onclick="openPhoto();"><img
								src="<%=path%>/page/common/showPhoto.action?dbProperty=photo&amp;compressSize=133"
								border="0" /> </a>
					</div>
					<div>
						<a href="#" onclick="openPhoto();">查看照片</a>
					</div>
				</div>
				<div class="mymoney">
					<ul class="xinxi">
						<li>
							您的企业名称:
							<bean:write name="account" property="name" />
							<logic:empty name="idcardStatus">
								您未进行
								<a href="#"
									onclick="loading('<%=path%>/page/myspace/toClearAccount.do');">企业结算账户认证</a>
							</logic:empty>
							<logic:equal name="idcardStatus"
								value="<%=Constant.AUTHENTICATION_STATUS_TOPUBMITTED%>">
								您未进行
								<a href="#"
									onclick="loading('<%=path%>/page/myspace/toClearAccount.do');">企业结算账户认证</a>
							</logic:equal>
							<logic:equal name="idcardStatus"
								value="<%=Constant.AUTHENTICATION_STATUS_SUBMITTED%>">
								您已经提交了企业结算账户认证，正在审核中……
							</logic:equal>
							<logic:equal name="idcardStatus"
								value="<%=Constant.AUTHENTICATION_STATUS_PASS%>">
								您已经通过了企业结算账户认证
							</logic:equal>
							<logic:equal name="idcardStatus"
								value="<%=Constant.AUTHENTICATION_STATUS_UNPASS%>">
								您的企业结算账户认证未通过
								<a href="#"
									onclick="loading('<%=path%>/page/myspace/toClearAccount.do');">企业结算账户认证</a>
							</logic:equal>
						</li>
						<li>
							(
							<bean:write name="account" property="email" />
							)
						</li>
						<li>
							交易账户编码：
							<bean:write name="account" property="accountId" />
						</li>

						<li>
							您的交易账户
							<%
						int subAccountNum = 0;
						%>
						</li>
						<logic:iterate id="sub" name="account" property="subAccounts">
							<li>
								<%
								subAccountNum++;
								%>
								<bean:write name="sub" property="accountName" />
								：
								<span class="lan"><bean:write name="sub"
										property="accountBalance.balance" format="#,###.##" /> </span> 冻结金额：
								<span class="lan"><logic:present name="sub"
										property="accountBalance.lockAmount">
										<bean:write name="sub" property="accountBalance.lockAmount"
											format="#,###.##" />
									</logic:present> <logic:notPresent name="sub"
										property="accountBalance.lockAmount">0</logic:notPresent> </span>

							</li>
						</logic:iterate>
						<%
						if (subAccountNum > 0) {
						%>
						<li>
							余额汇总：
							<span class="lan"><bean:write name="sumBalance"
									format="#,###.##" /> </span> 冻结金额汇总：
							<span class="lan"><bean:write name="sumAmount"
									format="#,###.##" /> </span>
						</li>
						<%
						}
						%>
						</br>
							<logic:equal name="idcardStatus"
								value="<%=Constant.AUTHENTICATION_STATUS_SUBMITTED%>">
								<logic:empty name="account" property="ivrLoginPassword">
									<a href="#" title="输入确认金额"
										onclick="loading('<%=path%>/toConfirmAmount.do');">输入确认金额</a>
								</logic:empty>
							</logic:equal>
							<logic:notEmpty name="account" property="ivrLoginPassword">
										确认金额:  <bean:write name="account" property="ivrLoginPassword" />
							</logic:notEmpty>
						</li>
					</ul>
				</div>
				<div class="logininfo">
					<div class="title">
						<span class="biaoti">登录信息</span>
					</div>
					<div class="lastlogintime">
					</div>
					<div class="editemail">
						<br>
						<br>
					</div>
					<div class="title" style="margin-top:5px;">
						<span class="biaoti">安全中心</span>
					</div>
					<div class="editemail" style="height:158px;">
						<%
								if (IAccountConst.COMPANY_TYPE_SIMPLE.equals(user
								.getCompanyType())) {
						%>
						<table style="margin-left:10px;">
							<tr>
								<td width="78">
									登录密码
								</td>
								<td width="165">
									<%
												if (IAccountConst.USERTYPE_CORP_OPERATOR.equals(user
												.getUserType())) {
									%>
									支付密码
									<%
									}
									%>
								</td>
							</tr>
							<tr>
								<td>
									<span class="lan"><a href="#"
										onclick="loading('<%=path%>/page/myspace/toModifyPassword.do?modifyType=<%=IAccountConst.MODIFY_TYPE_LOGIN%>');">修改登录密码</a>
									</span>
								</td>
								<!-- 普通操作员有修改支付密码功能 -->
								<%
											if (IAccountConst.USERTYPE_CORP_OPERATOR.equals(user
											.getUserType())) {
								%>
								<td>
									<span class="lan"><a href="#"
										onclick="loading('<%=path%>/page/myspace/toModifyPassword.do?modifyType=<%=IAccountConst.MODIFY_TYPE_PAY%>');">修改支付密码</a>
										&nbsp;&nbsp;|&nbsp;&nbsp;<a
										href="<%=path%>/page/myspace/forgotPayPassword.do">找回支付密码</a>
									</span>
								</td>
								<%
								}
								%>
								<td>
							</tr>
							<tr>
								<td colspan="2">
									企业信息
								</td>
							</tr>
							<tr>
								<td height="34" colspan="2">
									<span class="lan"><a href="#"
										onclick="loading('<%=path%>/page/myspace/modifyCorpAccountUserInfo.do');">修改企业信息</a>
									</span>
								</td>
							</tr>
						</table>
						<%
						}
						%>
					</div>
				</div>
			</div>
			<%
					if (user.getCompanyType() == null
					|| IAccountConst.COMPANY_TYPE_SIMPLE.equals(user
							.getCompanyType())) {
			%>
			<div class="mybank">
				我的银行账户
			</div>
			<div class="mybank1">
				<%--
				目前已添加了&nbsp;
				<span class="lan"><bean:write name="totalbank" /> </span>&nbsp;张银行卡&nbsp;&nbsp;&nbsp;&nbsp;
				<span class="lan"><a
					href="<%=path%>/page/myspace/accountList.do?modifyType=moveOut&modual=first">添加银行卡</a>
				</span>
			--%>
			</div>
			<div class="bankli">
				<table width="100%" class="tablestyle">
					<tr>
						<%--<th>
							<span class="blue14">默认</span>
						</th>
						--%>
						<th>
							<span class="blue14">银行开户名称</span>
						</th>
						<th>
							<span class="blue14">银行帐号</span>
						</th>
						<th>
							<span class="blue14">开户行</span>
						</th>
						<th>
							<span class="blue14">编辑</span>
						</th>
					</tr>
					<%
					int aBankIndex = 0;
					%>
					<%
					String defaultId = "";
					%>
					<logic:iterate name="aBankList" id="aBank" indexId="i">
						<bean:define id="aBankObj" name="aBank" />
						<%
									AccountBank ab = (AccountBank) aBankObj;
									if (ab.getDefaultFlag().equals("Y")) {
										defaultId = String.valueOf(ab.getId());
									}
						%>
						<tr
							class="<%=i.intValue() % 2 == 0 ? "tableWhiteBg"
											: "tableBlueBg"%>">
							<%--<td height="28" align="center">
								<input
									onclick="javascript:confirmModify('<bean:write name="displayBean" property="msg1"/>','<bean:write name="aBank" property="id"/>');"
									type="radio" style="border:0"
									<logic:equal value="Y" name="aBank" property="defaultFlag">checked</logic:equal>
							</td>
							--%>
							<td align="center">
								<bean:write name="aBank" property="bankAlias" />
							</td>
							<td align="center">
								<bean:write name="aBank" property="accountId" />
							</td>
							<td align="center">
								<ad:write typeid="CITY_INFO" name="aBank" property="citySeq" />
							</td>
							<td align="center">
								<a
									href="<%=path%>/page/myspace/accountDetail.do?aBankID=<bean:write name="aBank" property="id"/>"><img
										alt="编辑" src="<%=path%>/images/edit_icon.gif" width="16"
										height="16" border="0" /> </a>
							</td>
						</tr>
						<%
						aBankIndex++;
						%>
					</logic:iterate>
				</table>
			</div>
			<%
			}
			%>
		</div>
		<%
		}
		%>

	</div>

	<script language="javascript">
	function confirmModify(msg, aBankId) {
		 if (confirm(msg)) {
			location.href='<%=path%>/page/myspace/accountSetDefaultsSpace.do?aBankID='+aBankId;
		}
	}
</script>

